package top.gokzzz.serialnumber.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * 流水號
 *
 * @author Gok
 */
@Entity
@Table(name = "SER_NUM_CONF", uniqueConstraints = @UniqueConstraint(columnNames = {"TYPE1"}))
public class SerialNumberConfig {

    public enum Type {
        // TODO 自行擴展
        TEST,
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 格式
     */
    @Column(name = "FORMAT", nullable = false)
    private String format;

    /**
     * 日期格式
     */
    @Column(name = "DATE_FORMAT", nullable = false)
    private String dateFormat;

    /**
     * 當前序號
     */
    @Column(name = "SEQ", nullable = false)
    private Long seq = 0L;

    /**
     * 序號長度
     */
    @Column(name = "SEQ_LENGTH", nullable = false)
    private Integer seqLength;

    /**
     * 類型
     */
    @Enumerated(EnumType.STRING)
    @Column(name = "TYPE1", length = 30, nullable = false)
    private Type type;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getFormat() {
        return format;
    }

    public void setFormat(String format) {
        this.format = format;
    }

    public Long getSeq() {
        return seq;
    }

    public void setSeq(Long seq) {
        this.seq = seq;
    }

    public Type getType() {
        return type;
    }

    public void setType(Type type) {
        this.type = type;
    }

    public Integer getSeqLength() {
        return seqLength;
    }

    public void setSeqLength(Integer seqLength) {
        this.seqLength = seqLength;
    }

    public String getDateFormat() {
        return dateFormat;
    }

    public void setDateFormat(String dateFormat) {
        this.dateFormat = dateFormat;
    }

}
